﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Summer.Core.Aop;

#region License
/*
 *  Copyright (c) Dumuzi.cn 2009 , All rights reserved.
 *  CLR Version:  2.0.50727.4927
 *  NameSpace: Summer.Log
 *  Author:Edwin Tai,戴佳顺
 *  Msn:edwin19861218@hotmail.com
 *  QQ: 1961218
 *  Date:2009/10/27 16:37:20
 *  Licensed under the Microsoft Public License (Ms-PL)
 *  This license governs use of the accompanying software. 
 *  If you use the software, you accept this license.
 *  If you do not accept the license, do not use the software.
 */
#endregion

namespace Summer.Log
{
    /// <summary>
    /// Aop log for function before run and after run
    /// </summary>
    [AttributeUsage(AttributeTargets.Class)]
    public class LogAttribute : AbstractAOPAttribute
    {
        private bool m_isCalculateTimeout;
        public LogAttribute()
            : base()
        {
            m_isCalculateTimeout = false;
        }
        /// <summary>
        /// Log console out
        /// </summary>
        /// <param name="isCalculateTimeout">calculate timeout or not</param>
        public LogAttribute(bool isCalculateTimeout)
            : base()
        {
            m_isCalculateTimeout = isCalculateTimeout;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="aspectXml">Config file path</param>
        public LogAttribute(string aspectXml)
            : base(aspectXml)
        {
            m_isCalculateTimeout = false;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="aspectXml">Config file path</param>
        /// <param name="isCalculateTimeout">Is console timeout</param>
        public LogAttribute(string aspectXml, bool isCalculateTimeout)
            : base(aspectXml)
        {
            m_isCalculateTimeout = isCalculateTimeout;
        }
        protected override AbstractAOPProperty GetAOPProperty()
        {
            return new LogAOPProperty(m_isCalculateTimeout);
        }
    }
}
